<template>
  <div class="container">
    <div>
      账号: <input class="input-group" type="text" v-model="loginForm.acc" />
    </div>
    <div>
      密码: <input class="input-group" type="text" v-model="loginForm.pwd" />
    </div>

    <!--  <RouterLink to="/home">登录</RouterLink> -->
    <button type="button" class="btn btn-primary col-12 mt-3" @click="handler">登 录</button>
  </div>
</template>

<script setup>
import { ref, onUnmounted } from 'vue';
import { useRouter, useRoute, onBeforeRouteLeave } from 'vue-router';

// 获取路由对象
const router = useRouter();

// 获取路由单元对象
const route = useRoute();

const loginForm = ref({
  acc: '',
  pwd: ''
});


const handler = e => {
  // 事件处理函数中执行 push | replace
  // sessionStorage.setItem('account',loginForm.value.acc);
  router.push('/home/comp1');

}

onUnmounted(() => {
  console.log('Login 组件 onUnmounted.....');
})

onBeforeRouteLeave(() => {
  console.log('Login onBeforeRouteLeave');
});


</script>

<style lang="scss" scoped></style>